#ifndef _LIST
#define _LIST

#include "common.h"

#define MAX_SERVER 10
#define REMOVE_NODE 20
#define MAX_NODE 2000

struct server{
	int length;			//number of cmd
	int server_id;	
	int min_seq_id;
	int max_seq_id;
	int max_rcv_id;
	struct node *header;
};

struct node{
	struct command *cmd;
	struct node *next;
	struct node *pre;
};

static struct server *servers[MAX_SERVER];
static int server_count ;

struct server * find_server(int server_id);
void new_server(int server_id);
int rcv_cmd(struct command *);
void send_cmd(struct server *sv, int start_id, int end_id,int flag);
void print_all_cmd();
void print_server_cmd(int server_id);

#endif
